home *** CD-ROM | disk | FTP | other *** search
- /* *********************************************************************************
-
- FILE: Menu.c
-
- DESCRIPTION: Simple menu processing. Use the File Menu slot to do the Mandelbrot
- parameter selection
-
- AUTHOR: Bruce E. Gladstone
-
- Copyright © 1990 by Bruce E. Gladstone, All Rights Reserved.
-
- Revision History:
- ============================================================
- 5/1/90 - Release to Compuserve
- ============================================================
-
- COMMENTS:
-
- None.
-
- ******************************************************************************** */
-
- #include <stdio.h>
- #include <MacTypes.h>
- #include <WindowMgr.h>
- #include <MenuMgr.h>
- #include <EventMgr.h>
- #include <ToolboxUtil.h>
- #include <ControlMgr.h>
- #include <color.h>
- #include <colortoolbox.h>
- #include "Mandelbrot.h"
-
-
- /* ---------------------------- Global Variables ---------------------------------- */
-
- extern int colorQD;
- extern int quitFlag;
- extern int linearFlag;
- extern int custPict;
- extern int numColorBits;
- extern int numColors, brushSize;
- extern int limit;
- extern int n;
- extern long startTime, now;
- extern float res;
- extern float centx, centy;
- extern float xmin, xmax, ymin, ymax;
- extern float delx, dely;
-
- /* ---------------------------- Global MacTypes ----------------------------------- */
-
- extern Str255 str;
- extern CTabHandle myColorHandle;
- extern RGBColor aColor;
- extern Rect myRect, dragRect;
- extern WindowPtr aboutWindow;
- extern MenuHandle appleMenu, mandelMenu, editMenu, xMenu, yMenu, resMenu, timeMenu;
- extern WindowPtr myWindow;
-
- /* --------------------------- Local Prototypes --------------------------------- */
-
- void doMenu ( long );
- void aboutDialog ( void );
-
- /* --------------------------------------------------------------------------------
- doMenu - 5/01/90 beg
- -------------------------------------------------------------------------------- */
-
- void
- doMenu ( mResult )
- long mResult;
-
- {
- int theItem;
- int theMenu;
- int temp;
-
- theMenu = HiWord ( mResult );
- theItem = LoWord ( mResult );
- switch ( theMenu )
- {
- case appleID:
- if ( theItem == 1 )
- {
- aboutDialog ();
- }
- else
- {
- GetItem ( appleMenu, theItem, str );
- temp = OpenDeskAcc ( str );
- SetPort ( myWindow );
- }
- break;
- case mandelID:
- switch ( theItem )
- {
- case 1:
- limit = 64;
- CheckItem ( mandelMenu, 1, TRUE );
- CheckItem ( mandelMenu, 2, FALSE );
- CheckItem ( mandelMenu, 3, FALSE );
- break;
- case 2:
- limit = 256;
- CheckItem ( mandelMenu, 2, TRUE );
- CheckItem ( mandelMenu, 1, FALSE );
- CheckItem ( mandelMenu, 3, FALSE );
- break;
- case 3:
- limit = 1024;
- CheckItem ( mandelMenu, 3, TRUE );
- CheckItem ( mandelMenu, 1, FALSE );
- CheckItem ( mandelMenu, 2, FALSE );
- break;
- case 5:
- linearFlag = FALSE;
- CheckItem ( mandelMenu, 5, TRUE );
- CheckItem ( mandelMenu, 6, FALSE );
- break;
- case 6:
- linearFlag = TRUE;
- CheckItem ( mandelMenu, 6, TRUE );
- CheckItem ( mandelMenu, 5, FALSE );
- break;
- case 8:
- brushSize = 1;
- CheckItem ( mandelMenu, 8, TRUE );
- CheckItem ( mandelMenu, 9, FALSE );
- CheckItem ( mandelMenu, 10, FALSE );
- CheckItem ( mandelMenu, 11, FALSE );
- break;
- case 9:
- brushSize = 2;
- CheckItem ( mandelMenu, 8, FALSE );
- CheckItem ( mandelMenu, 9, TRUE );
- CheckItem ( mandelMenu, 10, FALSE );
- CheckItem ( mandelMenu, 11, FALSE );
- break;
- case 10:
- brushSize = 4;
- CheckItem ( mandelMenu, 8, FALSE );
- CheckItem ( mandelMenu, 9, FALSE );
- CheckItem ( mandelMenu, 10, TRUE );
- CheckItem ( mandelMenu, 11, FALSE );
- break;
- case 11:
- brushSize = 8;
- CheckItem ( mandelMenu, 8, FALSE );
- CheckItem ( mandelMenu, 9, FALSE );
- CheckItem ( mandelMenu, 10, FALSE );
- CheckItem ( mandelMenu, 11, TRUE );
- break;
- case 13:
- quitFlag = TRUE;
- break;
- }
- break;
- case editID:
- temp = (int)SystemEdit ( theItem - 1 );
- break;
- }
- HiliteMenu ( 0 );
- } /* doMenu ( mResult ) */
-
- /* =============================== EOF ==========================================
- Copyright © 1990 by Bruce E. Gladstone, All Rights Reserved.
- ================================================================================ */
-
-